#Twisted Shootout
#Copyright (C) 2007 Han Dao
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

#You can contact the author at wikipediankiba@gmail.com

import pygame
import data
import graphic

class Select:
	def __init__(self):
		self.sprites =  pygame.sprite.RenderPlain()
		self.data = data.read
		self.value = 0
	def activate(self):
		self.choice()
		self.selectdraw()
		self.add()
	def choice(self):
		image = self.data.load("block",True)
		self.block = graphic.Graphic(image)
		self.block.rect.x = 90
		self.block.rect.y = 630
		image = self.data.load("block2",True)
		self.block2 = graphic.Graphic(image)
		self.block2.rect.x = 180
		self.block2.rect.y = 630
		image = self.data.load("wall1",True)
		self.wall1 = graphic.Graphic(image)
		self.wall1.rect.x = 270
		self.wall1.rect.y = 630
		image = self.data.load("tunnel",True)
		self.tunnel = graphic.Graphic(image)
		self.tunnel.rect.x = 360
		self.tunnel.rect.y = 630
		image = self.data.load("win",True)
		self.win = graphic.Graphic(image)
		self.win.rect.x = 450
		self.win.rect.y = 630
		image = self.data.load("start",True)
		self.start = graphic.Graphic(image)
		self.start.rect.x = 540
		self.start.rect.y = 630
		image = self.data.load("blank",True)
		self.blank = graphic.Graphic(image)
		self.blank.rect.x = 870
		self.blank.rect.y = 220
		image = self.data.load("medickit",True)
		self.medickit = graphic.Graphic(image)
		self.medickit.rect.x = 630
		self.medickit.rect.y = 630
		image = self.data.load("cache",True)
		self.cache = graphic.Graphic(image)
		self.cache.rect.x = 720
		self.cache.rect.y = 630
	def selectdraw(self):
		image = self.data.load("select",True)
		self.sel = graphic.Graphic(image)
		self.sel.rect.x = 850
		self.sel.rect.y = 200
		image = self.data.load("blank",True)
		self.current = graphic.Graphic(image)
		self.current.rect.x = 870
		self.current.rect.y = 220
	def add(self):
		self.sprites.add(self.block,self.block2,self.wall1,self.tunnel,self.win,self.sel,self.current,self.start,self.medickit,self.cache)
	def change(self):
		if self.value == 3:
			self.current.image = self.data.load("block",True)
		elif self.value == 2:
			self.current.image = self.data.load("wall1",True)
		elif self.value == 4:
			self.current.image = self.data.load("block2",True)
		elif self.value == 5:
			self.current.image = self.data.load("tunnel",True)
		elif self.value == 7:
			self.current.image = self.data.load("win",True)
		elif self.value == 0:
			self.current.image = self.data.load("blank",True)
		elif self.value == 8:
			self.current.image = self.data.load("start",True)
		elif self.value == 9:
			self.current.image = self.data.load("medickit",True)
		elif self.value == 10:
			self.current.image = self.data.load("cache",True)